import 'dart:convert';

import 'package:aegis_flutter_sdk/aegis_flutter_sdk.dart';
import 'package:aegis_flutter_sdk/src/pipes/report.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  group('reporttest', () {
    test('build String Params', () {
      List<NormalLog> logs = [
        NormalLog(msg: 'Error: script error', level: LogType.error)
      ];
      String expectoutput =
          'msg[0]=Error%3A%20script%20error&level[0]=4&count=1';
      expect(buildLogParams(logs), expectoutput);
    });

    test('build String Params', () {
      List<NormalLog> logs = [
        NormalLog(msg: jsonEncode({'key': 'value'}), level: LogType.error)
      ];
      String expectoutput =
          'msg[0]=%7B%22key%22%3A%22value%22%7D&level[0]=4&count=1';
      String actualOutput = buildLogParams(logs);
      expect(actualOutput, expectoutput);
    });
  });
}
